package cn.ronghuanet.gift.client;

import cn.ronghuanet.gift.domain.LoginUser;
import cn.ronghuanet.gift.util.AjaxResult;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class LoginUserClientFallbackFactory implements FallbackFactory<LoginUserClient> {
    @Override
    public LoginUserClient create(Throwable throwable) {
        return new LoginUserClient() {
            @Override
            public AjaxResult addOrUpdate(LoginUser loginUser) {
                log.error("系统异常!"+ throwable.getMessage());
                return AjaxResult.me().setSuccess(false).setMessage("系统异常!请联系管理员!");
            }
        };
    }
}
